﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Core.DatabaseAccess
{
    public class Connection
    {
        public static IDbConnection OpenConnection()
        {
            IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["CONN_STRING"].ConnectionString);

            try
            {
                connection.Open();
                return connection;
            }
            catch(Exception ex)
            {
                connection.Close();
                connection.Dispose();
                return null;
            }
        }
    }
}
